<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    .iframeClass{
        height: 500px !important;
    }
</style>
<body>
<div th:insert="common.html"></div>
<div class="btn-group" style="margin-left: 16px">
    <button type="button" class="btn btn-primary dropdown-toggle"  style="text-shadow: black 5px 3px 3px;" data-toggle="dropdown">账户
        <span class="glyphicon glyphicon-user"></span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li><a href="/logout" style="color: orangered">退出登录</a></li>
    </ul>
</div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-3">
                <div id="tree"></div>
            </div>
            <div class="col-lg-9">
                <ul class="nav nav-tabs" id="myTab"></ul>
                <ul class="tab-content"></ul>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    function getTree() {
        var tree = [];
        $.ajax({
            url : "/menu/getInfo",
            type : "get",
            dataType : "json",
            async : false,
            success : function (data){
                tree = data;
            },
            error : function (data){
                alert("网络错误")
            }
        })
        return tree;
    }

    $("#tree").treeview({
        data: getTree(),
        onNodeSelected: function (event,data){
            if (data.nodes == undefined){
                /*添加addtabs*/
                $.addtabs.add({
                    title : data.text,
                    url: data.url,
                    id : data.id
                })
            }
        }
    });
</script>